package com.imay.live.helper;

import android.util.Log;

import java.math.RoundingMode;
import java.text.DecimalFormat;

/**
 * Created by  nick on 2017/4/25 0025.
 *  处理大额数字,适用粉丝数和余额
 */

public class NumberHelper {
    /**
     * 关注和被关注
     * @param number
     * @return
     */
    public static String getFormatNumberFollow(double number){
        String str = "";
        if (number>=100000){
            double d = number/10000d;
            DecimalFormat decimalFormat = new DecimalFormat("#.0");
            decimalFormat.setRoundingMode(RoundingMode.FLOOR);
            str=decimalFormat.format(d)+"w";
        }else{
            str=String.format("%.0f",number);
        }
        return str;

    }
    /**
     * 魅力和余额
     * @param number
     * @return
     */
    public static String getFormatNumberMoney(double number){
        String str = "";
        if (number>=1000000){
            double d = number/10000d;
            DecimalFormat decimalFormat = new DecimalFormat("#.0");
            decimalFormat.setRoundingMode(RoundingMode.FLOOR);
            str=decimalFormat.format(d)+"w";

        }else{
            str=String.format("%.0f",number);
        }
        return str;

    }


}
